package com.wgb.movie.model.vo;

import cn.hutool.json.JSONUtil;
import com.wgb.movie.model.entity.Theater;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 影院视图
 */
@Data
public class TheaterVO implements Serializable {

    /**
     * id
     */
    private Long id;

    /**
     * 影院名称
     */
    private String theaterName;

    /**
     * 影院地址
     */
    private String theaterAddress;

    /**
     * 海报URL
     */
    private String theaterIcon;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 更新时间
     */
    private Date updateTime;


    /**
     * 封装类转对象
     *
     * @param theaterVO
     * @return
     */
    public static Theater voToObj(TheaterVO theaterVO) {
        if (theaterVO == null) {
            return null;
        }
        Theater theater = new Theater();
        BeanUtils.copyProperties(theaterVO, theater);
        return theater;
    }

    /**
     * 对象转封装类
     *
     * @param theater
     * @return
     */
    public static TheaterVO objToVo(Theater theater) {
        if (theater == null) {
            return null;
        }
        TheaterVO theaterVO = new TheaterVO();
        BeanUtils.copyProperties(theater, theaterVO);
        return theaterVO;
    }
}
